# 只获取: 命令输出内容
import subprocess


# 检查系统系统是否已同步ntp网络时间
def is_time_synchronized():
    try:
        output = subprocess.check_output(["timedatectl", "status"])
        output = output.decode("utf-8")
        if "System clock synchronized: yes" in output:
            return True
        else:
            return False
    except Exception as e:
        print(e)
        return False


print("time sync :", is_time_synchronized())
